/****************************************************
          File Name:12-3.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 26 Dec 2014 02:52:12 PM CST
*****************************************************/

#include "12-3.h"

using std::cout;

const int STKS = 4;

int main()
{
    Stock stocks[STKS] =
    {
        Stock("Nanosmart", 12, 20.0),
        Stock("Boffo Object", 200, 2.0),
        Stock("Monolithic Obelisks", 130, 3.25),
        Stock("Fleep Enterprises", 60, 6.5)
    };

    cout << "Stock holding:\n";
    int st;
    for(st = 0; st < STKS; st++)
        cout << stocks[st];
    const Stock *top = &stocks[0];
    for(st = 1; st < STKS; st++)
        top = &top->topval(stocks[st]);

    cout << "\nMost valueble holding:\n";
    cout << *top;

    return 0;
}
